package main
import (
	"fmt"
)

type Goods struct {
	Name string
	Price float64
}

type Brand struct {
	Name string
	Address string
}

type Item struct {
	Goods
	Brand
}
type Item2 struct {
	*Goods
	*Brand
}

func main()  {
	// Item (存储值)
	// 写法 1
	tv := Item{
		Goods{"电视机", 5999.00},
		Brand{"小米", "东莞"},
	}
	fmt.Println("Item1", tv)
	// 写法 2
	phone := Item{
		Goods{
			Price: 5999.00,
			Name: "手机",
		},
		Brand{
			Name: "苹果",
			Address: "深圳",
		},
	}
	fmt.Println("Item2", phone)

	// Item2 (存储地址)
	// 写法 3
	console := Item2{
		&Goods{"PS4", 1099.00},
		&Brand{"索尼", "美国"},
	}
	fmt.Println("Item3", *console.Goods, *console.Brand)
	// 写法 4
	ipad := Item2{
		&Goods{
			Name: "ipad",
			Price: 3099.00,
		},
		&Brand{
			Name: "苹果", 
			Address: "美国",
		},
	}
	fmt.Println("Item4", *ipad.Goods, *ipad.Brand)
}